﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using GCalendar = Google.GData.Calendar;
using Google.GData.Extensions;

namespace GJReminder.Utils
{
    public static class ExtensionMethods
    {
        public static string GetLocationString(this ExtensionCollection<Where> locations)
        {
            StringBuilder sb = new StringBuilder();
            foreach (var location in locations)
            {
                sb.AppendFormat("{0}; ", location.ValueString);
            }
            return sb.ToString(0, sb.Length - 2);
        }

        public static IEnumerable<Model.EventDataModel> WrapEntry(this IEnumerable<GCalendar.EventEntry> entryList)
        {
            var result = from entry in entryList
                         from time in entry.Times
                         select new Model.EventDataModel(entry, time);
            return result;
        }
    }
}
